package com.ruoyi.web.controller.kiku;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.kiku.domain.KikuFilmLines;
import com.ruoyi.kiku.service.IKikuFilmLinesService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 影视台词Controller
 *
 * @author TT
 * @date 2025-07-31
 */
@RestController
@RequestMapping("/kiku/lines")
public class KikuFilmLinesController extends BaseController
{
    @Autowired
    private IKikuFilmLinesService kikuFilmLinesService;

    /**
     * 查询影视台词列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:lines:list')")
    @GetMapping("/list")
    public TableDataInfo list(KikuFilmLines kikuFilmLines)
    {
        startPage();
        List<KikuFilmLines> list = kikuFilmLinesService.selectKikuFilmLinesList(kikuFilmLines);
        return getDataTable(list);
    }

    /**
     * 导出影视台词列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:lines:export')")
    @Log(title = "影视台词", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, KikuFilmLines kikuFilmLines)
    {
        List<KikuFilmLines> list = kikuFilmLinesService.selectKikuFilmLinesList(kikuFilmLines);
        ExcelUtil<KikuFilmLines> util = new ExcelUtil<KikuFilmLines>(KikuFilmLines.class);
        util.exportExcel(response, list, "影视台词数据");
    }

    /**
     * 获取影视台词详细信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:lines:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(kikuFilmLinesService.selectKikuFilmLinesById(id));
    }

    /**
     * 新增影视台词
     */
    @PreAuthorize("@ss.hasPermi('kiku:lines:add')")
    @Log(title = "影视台词", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody KikuFilmLines kikuFilmLines)
    {
        return toAjax(kikuFilmLinesService.insertKikuFilmLines(kikuFilmLines));
    }

    /**
     * 修改影视台词
     */
    @PreAuthorize("@ss.hasPermi('kiku:lines:edit')")
    @Log(title = "影视台词", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody KikuFilmLines kikuFilmLines)
    {
        return toAjax(kikuFilmLinesService.updateKikuFilmLines(kikuFilmLines));
    }

    /**
     * 删除影视台词
     */
    @PreAuthorize("@ss.hasPermi('kiku:lines:remove')")
    @Log(title = "影视台词", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(kikuFilmLinesService.deleteKikuFilmLinesByIds(ids));
    }
}
